/*
 * @features: 功能
 * @description: 说明
 * @Date: 2021-10-11 23:11:35
 * @Author: judu233(769471424@qq.com)
 * @LastEditTime: 2021-10-13 00:21:35
 * @LastEditors: judu233
 */

import { GameData } from "../data/GameData";
import { Logic } from "../logic/Logic";
import c3d from "../tool/cc";
import UIView from "./ui/UIView";

declare global {
    type BUNDLE_TYPE = string | import("cc").AssetManager.Bundle;
    interface ManagerPrintDelegate<T> {
        print(data: T): void;
    }
    interface CacheManagerPrintDelegate<T, U> {
        printLocal(data: T, key: string): void;
        printRemote(spriteFrameCaches: T, caches: T, infos: U): void;

    }
    interface GameDataClass<T extends GameData> extends BundleClass<T> {
    }

    interface UIClass<T extends UIView> {
        new(): T;
        /**
         *视图prefab 地址 resources目录下如z_panels/WeiZoneLayer 
         */
        getPrefabUrl(): string;
    }
    interface IFullScreenAdapt {
        /**全屏幕适配 调用 */
        onFullScreenAdapt(): void;
    }
    type ViewAction = (complete: () => void) => void;

    interface OpenOption {
        /**打开界面的类型 */
        type: UIClass<UIView>;
        /**视图绑定预置资源所在bundle,默认为resources目标 */
        bundle?: BUNDLE_TYPE;
        /**节点层级，默认为0 */
        zIndex?: number;
        /**
         * 
         * delay > 0 时间未加载界面完成显示加载动画，
         * delay = 0 则不显示加载动画，但仍然会显示UILoading,在加载界面时阻挡玩家的触摸事件
         * delay 其它情况以UILoading的默认显示时间为准
         */
        delay?: number;
        /**默认""
         * 界面名字，如商城，个人信息,当delay>0时，加载超时后，会提示显示某某界面失败 
         * 否则默认提示加载界面失败
         **/
        name?: string;
        /**是否是预加载预置资源，默认为false */
        preload?: boolean;
        /**用户自定义参数 */
        args?: any | any[];
    }

    interface DefaultOpenOption extends OpenOption {
        /**视图绑定预置资源所在bundle,默认为resources目标 */
        bundle: BUNDLE_TYPE;
        /**节点层级，默认为0 */
        zIndex: number;
        /**是否是预加载预置资源，默认为false */
        preload: boolean;
    }

    interface UIManagerPrintDelegate<T, U, V> {
        printViews?(data: T, key: string): void;
        printChildren?(data: U): void;
        printComp?(data: V): void;
    }

    interface BundleClass<T> {
        new(): T;
        /**@description 当前bundle名 */
        bundle: string;
    }
    interface LogicClass<T extends Logic> extends BundleClass<T> {
    }
    interface ManagerPrintDelegate<T> {
        print(data: T): void;
    }
    interface GameViewClass<T extends UIView> {
        new(): T;
        logicType: LogicClass<Logic>;
    }


}